package com.jianzong.lingxuan.enums;

import com.jianzong.lingxuan.base.Result;
import lombok.Getter;

/**
 * @auth Leiwenlong
 * @since 2021/7/19
 */
public enum ApiEnum {

    LOGIN(0,"login","登录"),
    REGISTER(1,"register","注册"),
    FRIENDLIST(1,"friendList","查看朋友列表"),
    GONGFALIST(1,"gongfaList","查看功法列表"),
    GETUSERINFO(1,"getUserInfo","查看用户信息"),
    LOGINBYID(1,"loginById","后台Id免登录"),
    QUERYTASKLIST(1,"queryTaskList","查看任务列表信息"),
    QUERYUSERPETSLIST(1,"queryUserPetsList","查看用户宠物信息"),
    QUERYUSERPETSSKILLLIST(1,"queryUserPetsSkillList","查看用户宠物技能信息"),
    GETEMAILINFO(1,"getEmailInfo","查看用户邮箱信息"),
    QUERYFIRENINFO(1,"queryFirenInfo","查看朋友信息"),
    ADDFRIEND(1,"addFriend","添加朋友信息"),
    QUERYFRIENDAPPLICANTLIST(1,"queryFriendApplicantList","查看朋友验证消息"),
    SENDEMAIL(1,"sendEmail","发送朋友邮箱信息"),
    CHAT(1,"chat","聊天"),
    QUERYUSERMOUNTLIST(1,"queryUserMountList","查看用户骑宠信息"),
    QUERYUSERMOUNTSKILLLIST(1,"queryUserMountSKillList","查看用户骑宠技能信息"),
    SIMULATIONPK(1,"simulationPK","玩家PK"),
    NULL(999,"","");




    private int code;
    private String name;
    private String cnName;

    public int getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public String getCnName() {
        return cnName;
    }

    ApiEnum(int code, String login, String s) {
        this.code = code;
        this.name = login;
        this.cnName = s;
    }

    public static ApiEnum getByName(String name){
        for(ApiEnum transactType : values()){
            if (transactType.getName() .equals(name) ) {
                //获取指定的枚举
                return transactType;
            }
        }
        return NULL;
    }
}
